package com.dynamic.idea.quick.develop.plugin.entity.base02;

import com.dynamic.idea.quick.develop.plugin.entity.base02.model.FieldStruct;
import com.dynamic.idea.quick.develop.plugin.entity.base02.model.ImportStruct;
import com.dynamic.idea.quick.develop.plugin.utils.FilePathUtils;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.List;

/**
 * 通用的类结构
 */
public class GeneralClassStruct implements Serializable {

    /**
     * 属于哪一个包
     */
    private GeneralPackageStruct belongPackageStruct;

    /**
     * 简单类名
     */
    private String simpleClassName;

    /**
     * 生成的类名后缀
     */
    private String classNameSuffix;

    /**
     * 实现类的实现接口结构
     */
    private GeneralClassStruct implementsClassStruct;

    /**
     * 继承的类
     */
    private ImportStruct extendsImportStruct;

    /**
     * 注解列表
     */
    private List<ImportStruct> annotationImportStructList;

    /**
     *
     * 引用的子包结构，为空则无引用,比如service引用dao，dao则无需引用任何子包
     */
    private GeneralClassStruct fieldGeneralClassStruct;

    /**
     * 注入的Field的类结构 例如
     * @Autowired
     * private GeneralClassStruct struct;
     */
//    private FieldStruct fieldStruct;

    /**
     * Field列表
     */
    private List<FieldStruct> fieldStructList;

    /**
     * 类的注释
     */
    private String comment;

    /**
     * 是否是内部嵌入的类
     * 例如service的引用Mapper: this.baseMapper.testXXX()
     */
    private boolean isInternalEmbedding;

    /**
     * 内部嵌入的字段名
     */
    private String internalEmbeddingFiledName;

    /**
     * 嵌入的权限定名列表
     */
    private List<String> internalAnnotationQualifiedNameList;

    /**
     * 全类名
     * @return
     */
    public String getClassFullName(){
        return simpleClassName+classNameSuffix;
    }

    /**
     * 得到全限定名 例如：cn.sdpjw.order.TestClass
     * @return
     */
    public String getQualifiedName(){
        if (belongPackageStruct==null){
            return getClassFullName();
        }
        return belongPackageStruct.getPackageFullName()+"."+StringUtils.trim(getClassFullName());
    }


    // get/set


    public GeneralPackageStruct getBelongPackageStruct() {
        return belongPackageStruct;
    }

    public void setBelongPackageStruct(GeneralPackageStruct belongPackageStruct) {
        this.belongPackageStruct = belongPackageStruct;
    }

    public String getSimpleClassName() {
        return simpleClassName;
    }

    public void setSimpleClassName(String simpleClassName) {
        this.simpleClassName = simpleClassName;
    }

    public String getClassNameSuffix() {
        return classNameSuffix;
    }

    public void setClassNameSuffix(String classNameSuffix) {
        this.classNameSuffix = classNameSuffix;
    }

    public GeneralClassStruct getImplementsClassStruct() {
        return implementsClassStruct;
    }

    public void setImplementsClassStruct(GeneralClassStruct implementsClassStruct) {
        this.implementsClassStruct = implementsClassStruct;
    }

    public ImportStruct getExtendsImportStruct() {
        return extendsImportStruct;
    }

    public void setExtendsImportStruct(ImportStruct extendsImportStruct) {
        this.extendsImportStruct = extendsImportStruct;
    }

    public List<ImportStruct> getAnnotationImportStructList() {
        return annotationImportStructList;
    }

    public void setAnnotationImportStructList(List<ImportStruct> annotationImportStructList) {
        this.annotationImportStructList = annotationImportStructList;
    }

    public GeneralClassStruct getFieldGeneralClassStruct() {
        return fieldGeneralClassStruct;
    }

    public void setFieldGeneralClassStruct(GeneralClassStruct fieldGeneralClassStruct) {
        this.fieldGeneralClassStruct = fieldGeneralClassStruct;
    }

    public List<FieldStruct> getFieldStructList() {
        return fieldStructList;
    }

    public void setFieldStructList(List<FieldStruct> fieldStructList) {
        this.fieldStructList = fieldStructList;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public boolean isInternalEmbedding() {
        return isInternalEmbedding;
    }

    public void setInternalEmbedding(boolean internalEmbedding) {
        isInternalEmbedding = internalEmbedding;
    }

    public String getInternalEmbeddingFiledName() {
        return internalEmbeddingFiledName;
    }

    public void setInternalEmbeddingFiledName(String internalEmbeddingFiledName) {
        this.internalEmbeddingFiledName = internalEmbeddingFiledName;
    }

    public List<String> getInternalAnnotationQualifiedNameList() {
        return internalAnnotationQualifiedNameList;
    }

    public void setInternalAnnotationQualifiedNameList(List<String> internalAnnotationQualifiedNameList) {
        this.internalAnnotationQualifiedNameList = internalAnnotationQualifiedNameList;
    }
}
